Rewrite Initium from Go to Rust#13
Merged
Merged
Conversation
Complete reimplementation of all 6 subcommands in Rust: - wait-for (TCP + HTTP/HTTPS with retries, backoff, jitter) - migrate (command exec with lock file idempotency) - seed (command exec with structured logging) - render (envsubst + Jinja2 templates via minijinja) - fetch (HTTP fetch with auth, TLS, retry) - exec (arbitrary command with workdir support) Key dependencies: clap, ureq+rustls, serde_json, minijinja, regex, chrono 36 unit tests covering: logging, retry, safety, render modules All tests passing. Binary size comparison (release, stripped, musl-linked): - Go binary (scratch): ~7.4 MB - Rust binary (scratch): ~1.8 MB (76% reduction) Docker image (scratch + binary + CA certs): 1.83 MB total
- CI workflow: replace setup-go with dtolnay/rust-toolchain, use cargo test/clippy/fmt instead of go test/vet/staticcheck - Release workflow: use dtolnay/rust-toolchain for pre-push tests - jyq.Dockerfile: rewrite for Rust (rust:1.85-alpine builder, cargo build) - Dockerfile: already updated in prior commit - docs/design.md: update architecture diagram, directory structure, and 'How to Add a Subcommand' guide for Rust/clap - docs/usage.md: update template mode description (Go text/template -> minijinja) - README.md, FAQ.md: update image sizes (10MB -> 2MB), tool references - CHANGELOG.md: add Rust rewrite entry, update references - CLAUDE.md: add project config with cargo test references - tests/README.md: update from go test to cargo test
- Fix dead_code warnings: allow unused Warn variant and warn() method - Fix useless .into() conversion in logging JSON output - Fix manual Range::contains in fetch status check - Fix unit let-binding in command execution - Fix lines().flatten() -> lines().map_while(Result::ok) - Apply cargo fmt to all source files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete rewrite of Initium from Go to Rust, reducing Docker image size by 76%.
What changed
Language & Toolchain
Binary / Image Size
| | Go | Rust | Reduction |
|---|---|---|---|
| Docker image (scratch) | ~7.4 MB | 1.83 MB | 76% |
All 6 subcommands reimplemented:
wait-for— TCP + HTTP/HTTPS with retries, backoff, jittermigrate— command exec with lock-file idempotencyseed— command exec with structured loggingrender— envsubst + Jinja2 templates (via minijinja)fetch— HTTP fetch with auth, TLS, retryexec— arbitrary command with workdirCI/CD updated:
Docs updated:
Test results
How to verify
Breaking changes
gotemplatenow uses Jinja2 syntax:{{ env.VAR }}instead of{{.VAR}}